<template>
  <div class="news_detail">
    <h3 class="tit">买房还是炒股，2015年买房无法拒绝的5大理由</h3>
    <div class="info">
      <span>发表时间：{{ info.add_time | formatDate }}</span>
      <span>点击次数：{{ info.click }}</span>
    </div>
    <div class="content" v-html="info.content">
    
    </div>
    <my-comment :id="id"></my-comment>
  </div>
</template>

<script>
import Comment from './Comment.vue'
export default {

  data () {
    return {
      id:0,
      info:{}
    }
  },

  methods: {
    async getDetail () {
      var res = await this.$http.get('/api/getnew/'+this.id)
      console.log(res)
      this.info = res.data.message[0]
    }
  },

  created () {
    this.id = this.$route.params.id
    this.getDetail()
  },

  components:{
    'my-comment':Comment
  }
}
</script>

<style lang='less' scoped>
.news_detail {
  padding: 0px 10px;
  .tit{
    color:#1989fa;
    font-size: 14px;
    text-align: center;
    line-height: 30px;
    margin: 0;
    padding: 5px 0;
  }
  .info{
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #1989fa;
    border-bottom:1px solid #ccc;
    padding: 7px 0px;
  }
}
</style>